package model.commands.commandable;

import java.util.List;
import model.Environment;
import model.SyntaxErrorException;
import model.commands.Command;


/**
 * A command whose role is to move a Commandable object forward.
 * 
 * @author JLongley
 * @author Erick Gonzalez
 */
public class ForwardCommand extends Command {

    @Override
    public int evaluate(Environment e) throws SyntaxErrorException {
        List<Command> myArguments = getArguments();
        int distanceMoved = myArguments.get(0).evaluate(e);
        e.invokeCommandableMethod(Environment.MOVE, distanceMoved);
        return distanceMoved;
    }
}
